<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script>
    window.onload = function(){
        document.getElementsByTagName('a')[0].onclick = function(){

            const request = new XMLHttpRequest();
            
            const url = this.href
            const method = 'GET'

            request.open(method, url)

            request.send(null)

            request.onreadystatechange = function(){
                if(request.readyState == 4){
                    if(request.status == 200 || request.status == 304){
                        alert(request.responseText)
                    }
                }
            }


            return false

        }
    }
</script>
<body>
    <a href="helloAjax.txt">Hello</a>
</body>
</html>